package business.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Required;
import org.springframework.transaction.annotation.Transactional;

import vo.Paper;
import vo.User;
import business.PaperService;
import dao.PaperDAO;

public class PaperServiceImpl implements PaperService {

	private PaperDAO paperDao;

	public List<Paper> getAll() {
		return paperDao.findAll();
	}

	@Required
	public void setPaperDao(PaperDAO paperDao) {
		this.paperDao = paperDao;
	}

	@Transactional
	public void insert(Paper paper) {
		paperDao.create(paper);
	}

	@Transactional
	public void update(Paper paper) {
		paperDao.update(paper);
	}

	public Paper getById(long paperId) {
		return paperDao.read(paperId);
	}

	public List<Paper> getAll(int start,int pageSize) {
		return paperDao.findAll(start,pageSize);
	}
	public long getTotalCount() {
		return paperDao.findTotalCount();
	}

	public List<Paper> getAllByTitle(int start,int pageSize,String keyword) {
		return paperDao.findAllByTitle(start,pageSize,keyword);
	}

	public long getTotalCountByTitle(String keyword) {
		return paperDao.findTotalCountByTitle(keyword);
	}

}